﻿#region Description
/*  File Name:      MainMenuScreen.cs
 *  Author:         Adam Goodchild
 *  
 *  Description:    This class is the Main Menu Screen
 *                  This is the first thing that is displayed when the Game is loaded
 *                  It contains all of the main options, including the following:
 *                   - Play Game
 *                   - Options
 *                   - Exit Game
 *  
 *  Sources:        The Idea for this class was gained from the following source(s):
 *                  Microsoft XNA Creators Club - Game State Management Sample
*/
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using MinimizeEngine.Managers;
using MinimizeEngine.Menu_System;
using MinimizeEngine.Screens;
using MinimizeEngine.Networking;
using System;
#endregion

namespace MinimizeEngineDemo.Screens
{
    public class MainMenuScreen : MEMenuScreen
    {
        #region Initialization

        /// <summary>
        /// Constructs a new Main Menu
        /// </summary>
        public MainMenuScreen() : base("Sample 5 - Scene Graph", true)
        {
            //First create the Menu Entries to be displayed in the Main Menu
            MEMenuEntry playGameMenuEntry = new MEMenuEntry("Load Sample 5 - Scene Graph");
            MEMenuEntry exitGameMenuEntry = new MEMenuEntry("Exit Game");

            //We now have to Hook the Event Handlers for each Menu Entry, 
            //onto the Menu Entry itself
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            exitGameMenuEntry.Selected += OnMenuScreenCanceled;

            //Add all of the Menu Entries to the Main Menu
            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(exitGameMenuEntry);
        }
        #endregion

        #region Handle Input Events

        /// <summary>
        /// An Event Handler for the Play Game Menu Entry.
        /// This is called when it is Selected
        /// </summary>
        /// <param name="theSender"></param>
        /// <param name="pie"></param>
        void PlayGameMenuEntrySelected(object sender, EventArgs eventArgs)
        {
            LoadingScreen.Load(true, new GameScreenTest());
        }

        void P2PMenuEntrySelected(object sender, EventArgs eventArgs)
        {
            MEScreenManager.AddScreen(new MEPeerToPeerScreen(), 0);
        }

        /// <summary>
        /// An Event Handler for the Main Options Menu Entry.
        /// This is called when it is Selected
        /// </summary>
        /// <param name="theSender"></param>
        /// <param name="pie"></param>
        void MainOptionsMenuEntrySelected(object sender, EventArgs eventArgs)
        {
            //HANDLE THE CODE TO LOAD THE MAIN OPTIONS SCREEN HERE       
        }

        protected override void OnMenuScreenCanceled()
        {
            //SHOW A MESSAGE BOX TO CONFIRM EXIT
            MEEngineManager.Game.Exit();
        }

        #endregion
    }
}
